<?php defined('BASEPATH') or exit('No direct script access allowed');

class Module_File_manager extends Module {

	public $version = '1.1';

	public function info()
	{
		return array(
			'name' => array(
				'en' => 'File manager',
				'ar' => 'File manager',
				'el' => 'File manager',
				'br' => 'File manager',
				'pl' => 'File manager',
				'he' => 'File manager',
				'lt' => 'File manager',
				'ru' => 'File manager',
				'zh' => 'File manager',
				'id' => 'File manager'
			),
			'description' => array(
				'en' => 'File manager',
				'nl' => 'File manager',
				'es' => 'File manager', #update translation
				'fr' => 'File manager', #update translation
				'de' => 'File manager', #update translation
				'pl' => 'File manager',
				'br' => 'File manager',
				'zh' => 'File manager',
				'it' => 'File manager', #update translation
				'ru' => 'File manager',
				'ar' => 'File manager',
				'cs' => 'File manager', #update translation
				'sl' => 'File manager',
				'fi' => 'File manager', #update translation
				'el' => 'File manager',
				'he' => 'File manager',
				'lt' => 'File manager.',
				'da' => 'File manager',
				'id' => 'File manager'
			),
			'frontend'	=> TRUE,
			'backend'	=> FALSE,
			'skip_xss'	=> TRUE,
			'menu'		=> FALSE,
		);
	}

	public function install()
	{
		$this->db->query("
			CREATE  TABLE IF NOT EXISTS ".$this->db->dbprefix('uploking_folders')." (
  				`id` INT NOT NULL AUTO_INCREMENT ,
  				`user_id`  VARCHAR(255) NULL ,
				`parent_id`  INT NULL ,
				`name` VARCHAR(255) NULL,
				`created_on`  INT NULL ,
				`order`  INT NULL ,
			  PRIMARY KEY (`id`)
			) ENGINE=InnoDB DEFAULT CHARSET=utf8
		");
		$this->db->query("
			CREATE  TABLE IF NOT EXISTS ".$this->db->dbprefix('uploking_downloads')." (
  				`id` INT NOT NULL AUTO_INCREMENT ,
  				`file_id` INT NULL ,
				`ip` VARCHAR(255) NULL ,
				`status` INT NULL,
				`download_time`  INT NULL ,
			  PRIMARY KEY (`id`)
			) ENGINE=InnoDB DEFAULT CHARSET=utf8
		");
		$this->db->query("
			CREATE  TABLE IF NOT EXISTS ".$this->db->dbprefix('uploking_ratings')." (
  				`id` INT NOT NULL AUTO_INCREMENT ,
  				`file_id` INT NULL ,
  				`user_id` INT NULL ,
				`ip` VARCHAR(255) NULL ,
				`rating` INT NULL,
				`rating_time`  INT NULL ,
			  PRIMARY KEY (`id`)
			) ENGINE=InnoDB DEFAULT CHARSET=utf8
		");
		$this->db->query("
			CREATE  TABLE IF NOT EXISTS ".$this->db->dbprefix('uploking_withdrawals')." (
  				`id` INT NOT NULL AUTO_INCREMENT ,
  				`user_id` INT NULL ,
				`email_paypal` VARCHAR(255) NULL ,
				`pin` INT NULL,
				`money`  INT NULL ,
				`status` INT NULL,
				`create_time` INT NULL,
			  PRIMARY KEY (`id`)
			) ENGINE=InnoDB DEFAULT CHARSET=utf8
		");
		return $this->db->query("
			CREATE  TABLE IF NOT EXISTS ".$this->db->dbprefix('uploking_files')." (
  				  `id` int(11) NOT NULL AUTO_INCREMENT,
				  `folder_id` int(11) NOT NULL DEFAULT '0',
				  `user_id` int(11) NOT NULL DEFAULT '1',
				  `type` enum('a','v','d','i','o') COLLATE utf8_unicode_ci DEFAULT NULL,
				  `name` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
				  `filename` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
				  `extension` varchar(5) COLLATE utf8_unicode_ci NOT NULL,
				  `mimetype` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
				  `width` int(5) DEFAULT NULL,
				  `height` int(5) DEFAULT NULL,
				  `filesize` int(11) NOT NULL DEFAULT '0',
				  `date_added` int(11) NOT NULL DEFAULT '0',
				  `sort` int(11) NOT NULL DEFAULT '0',
			  PRIMARY KEY (`id`)
			) ENGINE=InnoDB DEFAULT CHARSET=utf8
		");
	}

	public function uninstall()
	{
		//it's a core module, lets keep it around
		return TRUE;
	}

	public function upgrade($old_version)
	{
		// Your Upgrade Logic
		return TRUE;
	}

	public function help()
	{
		/**
		 * Either return a string containing help info
		 * return "Some help info";
		 *
		 * Or add a language/help_lang.php file and
		 * return TRUE;
		 *
		 * help_lang.php contents
		 * $lang['help_body'] = "Some help info";
		*/
		return TRUE;
	}
}

/* End of file details.php */
